$(document).ready(function () {
    var floor = {
        //楼层左侧 tag区域
        floorTag : function (loca,floornum) {
            for(var i = 0; i < floornum.length; i++) {
                var $cont = $('<li><a href="#">' + floornum[i].tag + '</a></li>');
                $(loca).append($cont);
                $(loca).children("li:eq(2)").addClass("last");
                $(loca).children("li:eq(5)").addClass("last");
                $(loca).children("li:eq(8)").addClass("last");
            }
        },
        //楼层中间 list区域
        floorList : function(loca,floornum) {
            for(var i = 0; i < floornum.length; i++) {
                var $cont = $('<li>' +
                    '<span class="img">' +
                    '<a href="#"><img src="images/' + floornum[i].src + '" alt="" width="112px" height="150px"/></a>' +
                    '</span>' +
                    '<dl class="txt">' +
                    '<dt><a href="#">' + floornum[i].txt_dt + '</a></dt>' +
                    '<dd class="scroll">' +
                    '<span class="star"></span>' +
                    '<strong class="num">0.0</strong>' +
                    '</dd>' +
                    '<dd>' +
                    '<p class="time">' + floornum[i].time + '</p>' +
                    '<p class="place"><a href="#">' + floornum[i].place + '</a></p>' +
                    '<p class="price">￥<strong>' + floornum[i].price + '</strong>起</p>' +
                    '</dd>' +
                    '</dl>' +
                    '</li>'
                );
                $(loca).append($cont);
                $(loca).children("li:gt(1)").addClass("back");
            }
        },
        //楼层中间 comment区域
        floorComment : function (loca,floornum) {
            for(var i = 0; i < floornum.length; i++) {
                var $cont = $('<li>' +
                    '<span class="user"><img src="images/' + floornum[i].user + '"/></span>' +
                    '<div class="talk">' +
                    '<span class="name" title="' + floornum[i].name + '">' + floornum[i].name + '</span>评论了：' +
                    '<a href="#">' + floornum[i].txt + '</a>' +
                    '</div>' +
                    '</li>');
                $(loca).append($cont);
            }
        },
        //楼层右侧 news区域
        floorNews : function (loca, floornum) {
            for(var i = 0; i < floornum.length; i++) {
                var $cont = $('<li>' +
                    '<strong class="txt one-up">' + floornum[i].add + '</strong>' +
                    '<div class="works">' +
                    '<span>' + floornum[i].id + '</span>' +
                    '<p><a href="#">'+ floornum[i].content +'</a></p>' +
                    '</div>' +
                    '</li>');
                $(loca).append($cont);
                $(loca).children("li:lt(3)").find("span").addClass("one");
            }
        },
        //一楼右侧
        floorOne : function (loca, floornum) {
            for(var i = 0; i < floornum.length; i++) {
                var $cont = $('<li>' +
                    '<strong class="txt one-up"><img src="images/' + floornum[i].img + '"/></strong>' +
                    '<div class="works">' +
                    '<span>' + floornum[i].id + '</span>' +
                    '<p><a href="#">'+ floornum[i].content +'</a></p>' +
                    '</div>' +
                    '</li>');
                $(loca).append($cont);
                $(loca).children("li:lt(3)").find("span").addClass("one");
            }
        },
        //七楼
        floorSeven : function (loca, floornum) {
            for(var i = 0; i < floornum.length; i++) {
                var $cont = $('<li>' +
                    '<span class="img">' +
                    '<a href="#"><img src="images/' + floornum[i].img + '" width="70px" height="70px"/></a>' +
                    '</span>' +
                    '<div class="des">' +
                    '<p><a href="#">' + floornum[i].des + '</a></p>' +
                    '<p>仅售<span>￥<strong>' + floornum[i].price + '</strong></span></p>' +
                    '</div>' +
                    '</li>');
                $(loca).append($cont);
            }
        }
    };
    //一楼
    //  楼层左侧 tag区域
    floor.floorTag("#tag-one", floorOneTag);
    floor.floorList("#list-one", floorOneList);
    $("#list-one").children("li:odd").find("dd:eq(0)").children("span").addClass("star1");
    floor.floorComment("#comment-one", floorOneComment);
    floor.floorOne("#news-one1", floorOneNews1);
    floor.floorOne("#news-one2", floorOneNews2);
    // tab切换
    // 右侧 给li注册鼠标经过事件
    $(".floor .tab > li").mouseenter(function () {
        //获取当前li的索引
        var index = $(this).index();
        $(this).addClass("active").siblings("li").removeClass("active");
        //找到与之索引对应的.ode下的ul
        $(this).parent().next(".ode").children("ul").eq(index).show().siblings("ul").hide();
    });

    //二楼
    //  楼层中间 list区域
    floor.floorList("#list-two", floorTwoList);
    $("#list-two").children("li").find("dd:eq(0)").html("");
    //  楼层右侧 news区域
    floor.floorNews("#news-two", floorTwoNews);

    //三楼
    //  楼层左侧 tag区域
    floor.floorTag("#tag-three", floorThreeTag);
    floor.floorList("#list-three", floorThreeList);
    //  楼层中间 comment区域
    floor.floorComment("#comment-three", floorThreeComment);
    //  楼层右侧 news区域
    floor.floorNews("#news-three", floorThreeNews);

    //四楼
    //  楼层左侧 tag区域
    floor.floorTag("#tag-fore", floorForeTag);
    floor.floorList("#list-fore", floorForeList);
    //  楼层中间 comment区域
    floor.floorComment("#comment-fore", floorForeComment);
    //  楼层右侧 news区域
    floor.floorNews("#news-fore", floorThreeNews);

    //五楼
    //  楼层左侧 list区域
    floor.floorList("#list-five", floorFiveList);
    //  楼层右侧 news区域
    floor.floorNews("#news-five1", floorFiveNews1);
    floor.floorNews("#news-five2", floorFiveNews2);
    floor.floorNews("#news-five3", floorFiveNews3);


    //六楼
    //  楼层左侧 list区域
    floor.floorList("#list-six", floorSixList);
    $("#list-six").children("li").find("dd:eq(0)").html("");
    //  楼层右侧 news区域
    floor.floorNews("#news-six", floorSixNews);

    //七楼
    //  楼层左侧 list区域
    floor.floorList("#list-seven", floorSevenList);
    $("#list-seven").children("li").find("dd:eq(0)").html("");
    //  楼层右侧 shop区域
    floor.floorSeven("#shop", floorSevenNews);


    /*function sideNav() {
     var $cont = $('<a class="itm sort-i4" href="#doyen"><i></i><strong class="sort-name">戏剧<br>达人</strong></a>')
     }

     $(".sideNav").on("mouseenter", "itm", function () {
     $(this).find("i").hide();

     $(this).find("strong").hide();
     });*/
});


